// 函数用于检查屏幕是否全屏
function checkFullScreen() {
    var isFullScreen =
        window.innerWidth === screen.width &&
        window.innerHeight === screen.height;
    return isFullScreen;
}

// 如果不是全屏，则尝试进入全屏模式
if (!checkFullScreen()) {
    // 尝试全屏API
    if (document.documentElement.requestFullscreen) {
        document.documentElement.requestFullscreen();
    } else if (document.documentElement.mozRequestFullScreen) { /* Firefox */
        document.documentElement.mozRequestFullScreen();
    } else if (document.documentElement.webkitRequestFullscreen) { /* Chrome, Safari & Opera */
        document.documentElement.webkitRequestFullscreen();
    } else if (document.documentElement.msRequestFullscreen) { /* IE/Edge */
        document.documentElement.msRequestFullscreen();
    }
}